To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 4 minutes to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1
👀 Reading hidden code
using PenPlots, PlutoUI
1.7 s
👀 Reading hidden code
coords = [
Point(i, sin(i/5) + rand())
for i in 1:100
]
271 ms
👀 Reading hidden code
Path(coords)
13.6 μs
👀 Reading hidden code
69.4 μs
point_at_angle (generic function with 1 method)
👀 Reading hidden code
point_at_angle(a) = Point(cos(2π * a), sin(2π * a))
518 μs
80
👀 Reading hidden code
nturns = 80
10.8 μs
👀 Reading hidden code
@bind offset Slider(0:.01:5)
414 ms
👀 Reading hidden code
@bind scale Slider(0.9:.01:1.2)
17.6 ms
👀 Reading hidden code
11.0 μs
👀 Reading hidden code
[
Path(spiral(false)),
Path(spiral(true)),


# Path((scale * spiral()) .+ Point(offset, 0)),
]
336 ms
spiral (generic function with 1 method)
spiral(special::Bool) = [
if special
p = a * point_at_angle(a)
val = get_value_at(p / 80)

(a + (1-val) / 2) * point_at_angle(a)
else
a * point_at_angle(a)
end

for a in range(0, nturns, 100 * nturns)
]
👀 Reading hidden code
1.2 ms
👀 Reading hidden code
67.6 μs
👀 Reading hidden code
66.4 μs
using Images
👀 Reading hidden code
5.5 s
img = load(download("https://fonsp.com/img/doggoSmall.jpg?raw=true"))
👀 Reading hidden code
1.0 s
get_value_at (generic function with 1 method)
function get_value_at(p::Point)

max_size = maximum(size(img)) / 2

q = max_size * p + Point(max_size, max_size)


r(x) = round(Int, x)

color = get(
img,
(
r(q[2]),
r(q[1]),
),
zero(eltype(img)),
)
gray(Gray(color))
end
👀 Reading hidden code
1.3 ms
0.588N0f8
get_value_at(Point(1,0))
👀 Reading hidden code
7.7 ms